---
# tasks file for kiosk

- name: firefox repository
  ansible.builtin.apt_repository:
    repo: ppa:mozillateam/ppa

- name: firefox ppa priority
  ansible.builtin.copy:
    src: mozilla-ppa
    dest: /etc/apt/preferences.d/mozilla-ppa

- name: openbox & xorg server
  ansible.builtin.apt:
    pkg:
    - openbox
    - xorg
    - firefox

- name: autologin user
  ansible.builtin.user:
    name: "{{ kiosk_user }}"
    shell: /bin/bash
    password: $1$CExR/guh$ckg8U4qmhY1SifMlJ7INn0

- name: autologin directory
  ansible.builtin.file:
   path: /etc/systemd/system/getty@tty1.service.d
   state: directory
   mode: '755'

- name: autologin config
  ansible.builtin.template:
    src: override.conf
    dest: /etc/systemd/system/getty@tty1.service.d

- name: trassir autostart
  ansible.builtin.lineinfile:
    dest: /etc/xdg/openbox/autostart
    line: "firefox --kiosk {{ kiosk_url }}"

- name: firefox policies directory
  ansible.builtin.file:
    path: /etc/firefox/policies
    state: directory

- name: firefox policies
  ansible.builtin.copy:
    src: policies.json
    dest: /etc/firefox/policies/policies.json

- name: start X server
  ansible.builtin.lineinfile:
    dest: "/home/{{ kiosk_user }}/.bashrc"
    line: startx
  notify:
  - reboot
